API Documentation
String.h
1 // String.h
3 //
5 
6 namespace nkMemory
7 {
21  class String final
22  {
23  public :
24 
29  String () ;
36  String (const char* data) ;
43  String (unsigned long long size) ;
52  String (const char* data, unsigned long long size) ;
59  String (const StringView& view) ;
65  String (const String& other) ;
71  String (String&& other) noexcept ;
75  ~String () ;
76 
77  // Getters
81  char* getData () const ;
85  unsigned long long getSize () const ;
89  bool empty () const ;
93  char& front () ;
97  char& back () ;
98 
99  // Management
103  void clear () ;
110  void resize (unsigned long long size) ;
111 
112  // Operators
118  String& operator= (const char* data) ;
124  String& operator= (const StringView& other) ;
130  String& operator= (const String& other) ;
136  String& operator= (String&& other) noexcept ;
142  const char operator[] (unsigned long long index) const ;
148  char& operator[] (unsigned long long index) ;
154  void operator+= (char value) ;
160  void operator+= (const StringView& other) ;
167  String operator+ (char c) const ;
174  String operator+ (const char* other) const ;
181  String operator+ (const StringView& other) ;
188  bool operator== (const char* other) const ;
195  bool operator== (const StringView& other) const ;
202  bool operator!= (const char* other) const ;
209  bool operator!= (const StringView& other) const ;
210 
211  public :
212 
213  // Inlined constructors
220  String (const std::string& str) ;
227  String (const std::string_view& str) ;
228 
229  public :
230 
231  // Inlined operators
235  operator std::string () const ;
239  operator std::string_view () const ;
243  operator nkLog::String () const ;
247  operator nkLog::StringView () const ;
248 
255  StringView& operator= (const std::string& data) ;
262  StringView& operator= (const std::string_view& data) ;
263  } ;
264 
272  inline bool operator== (const char* c, const nkMemory::String& str) ;
273 
281  inline nkMemory::String operator+ (char c, const nkMemory::String& str) ;
289  inline nkMemory::String operator+ (const char* c, const nkMemory::String& str) ;
290 }
nkLog::StringView
Allows to exchange strings with external code.
Definition: StringView.h:18
nkMemory::String::String
String(const char *data)
nkMemory::String::String
String(const std::string_view &str)
nkMemory::String::operator!=
bool operator!=(const char *other) const
nkMemory::String::back
char & back()
nkMemory::String::front
char & front()
nkMemory::String::String
String(const std::string &str)
nkMemory::String::String
String(const String &other)
nkMemory::String::String
String(const StringView &view)
nkMemory::operator+
nkMemory::String operator+(char c, const nkMemory::String &str)
nkMemory::String::empty
bool empty() const
nkMemory::String::operator[]
const char operator[](unsigned long long index) const
nkMemory::String::operator+
String operator+(char c) const
nkMemory::operator==
bool operator==(const char *c, const nkMemory::String &str)
nkMemory::String
Class holding information about a string, with ownership over the data.
Definition: String.h:22
nkMemory::String::~String
~String()
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkMemory::String::String
String(unsigned long long size)
nkMemory::String::clear
void clear()
nkMemory::String::operator+=
void operator+=(char value)
nkMemory::String::String
String(const char *data, unsigned long long size)
nkMemory::String::operator==
bool operator==(const char *other) const
nkMemory::String::getData
char * getData() const
nkMemory::String::resize
void resize(unsigned long long size)
nkMemory::String::String
String()
nkMemory::String::getSize
unsigned long long getSize() const
nkMemory::String::operator=
String & operator=(const char *data)
nkMemory::String::String
String(String &&other) noexcept
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7